<template>
  <div>
    <x-header :right-options="{showMore: true}" @on-click-more="showMenus = true">我的理财</x-header>
    <div class="productDetailBox">
      <!-- <h3>{{financialData.name}}</h3> -->
      <div><p class="benefit">333.00</p></div>
    <div><p class="benefit">累计收益（元）</p></div>
      <div class="chart">
        <div class="item red">
          <strong>{{financialData.rate}}34.45</strong>
          <span>昨日收益（元）</span>
        </div>
        <div class="item">
          <strong>{{financialData.term}}83333.00</strong>
          <span>总投资（元）</span>
        </div>
      </div>
      <div class="chartInfo">
        <dfn class="progressBar">
          <i></i>
        </dfn>
        <div>
          <p class="left"><span> {{financialData.availableCredit}}</span><span>注：昨日收益与累计收益为预期收益</span></p>
        </div>
        <!-- <p class="left">进度 {{financialData.availableCredit}}% 剩余额度 {{financialData.totalAmountOfPurchase}}小于500万</p> -->
      </div>
    </div>
      <div class="scroll-container">
        <scroller lock-x scrollbar-y use-pullup :pullup-config="{ content: '上拉加载更多', downContent: '松开进行加载', upContent: '上拉加载更多', loadingContent: '加载中...' }" height="100%" ref="demo3" @on-pullup-loading="getMore" >
          <div class="scroll-box">
            <group v-for="(dataList, listsIndex) in dataLists" :key="listsIndex"  :title="dateFil(dataList.dateShow)" title-color="#333333" class="tran-detail-item">
              <ul>
                <li v-for="(data, dataIndex) in dataList.datasArr" :key="dataIndex">
                  <div class="detail-content">
                    <div class="expense-title">
                      <h4 class="expense-payee">{{data.payeeName}}</h4>
                      <p class="expense-info">
                        <span class="expense-item">{{data.tranDesc}}</span>
                        <span class="expense-date">{{data.tranDate}}</span>
                      </p>
                    </div>
                    <p class="expense-amount"><span>{{data.creditDebit=='C'?'-':'+'}}</span>{{data.tranAmt}}</p>
                  </div>
                </li>
              </ul>
            </group>
          </div>
        </scroller>
      </div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      financialData: {
        name: '', // 理财产品名
        rate: '', // 年化收益率
        profit: '', // 年化收益额
        term: '', // 投资期限
        availableCredit: '', // 剩余额度
        totalAmountOfPurchase: '', // 可购总额度
        remainingTime: '', // 还剩xx天购买
        openSaleDate: '', // 开售日
        cutOffDate: '', // 截止日
        interestDate: '', // 起息日
        dueDate: '', // 到期日
        list: {
          subTime: '', // 认购期
          productName: '', // 产品名称
          productType: '', // 产品类型
          currency: '', // 计价币种
          deliveryTime: '', // 产品交收日期
          expireTime: '', // 产品到期日期
          minBuyMoney: '', // 最低购买金额
          increaseMoney: '', // 递增金额
          saveBook: '', // 是否保本
          RiskGrade: '' // 风险等级
        }},
      buttonTxt: '购买' // 判断获得： 1.购买；2.去开户
    }
  },
  methods: {
    getFinancialData () {
      let _this = this
      window.WebViewJavascriptBridge.callHandler('nativeRequest',
        JSON.stringify({
          'requstSource': 'internetRequest',
          'url': 'http://whichat.icitic.net/mstep/mstep.do?act=business',
          'params': {'method_Name': 'showProDetail', 'user_Data': {'productId': '3015'}}
        }),
        function (response) {
          response = JSON.parse(response)
          if (response.status === 0 || response.status === '0') {
            _this.financialData = response.data.data[0]
          } else {
            console.log('fail')
          }
        })
    },
    gotoNext () {
      this.$router.push({name: 'FinancialShift'})
    }
  },
  created () {
    this.getFinancialData()
  }
}
</script>
<style>
button.subBtn {
  background-color: #ec1b30;
}
button.weui-btn_primary:not(.weui-btn_disabled):active {
  background: rgba(236,27,48,.6);
}
div.weui-wepay-flow, .weui-wepay-flow-auto {
  padding: .3rem .3rem 1rem;
}
div.step1 .weui-wepay-flow__title-bottom {
  top: 20px;
  left: 0;
  -webkit-transform: translate(0, 0);
  transform: translate(0, 0);
}
div.step4 .weui-wepay-flow__title-bottom {
  top: 20px;
  left: auto;
  right: 0;
  -webkit-transform: translate(0, 0);
  transform: translate(0, 0);
}
div.step1 .weui-wepay-flow__state, div.step2 .weui-wepay-flow__state {
  background-color: #3d477b;
}
div.step3 .weui-wepay-flow__state {
  background-color: #8fc31f;
}
div.step4 .weui-wepay-flow__state {
  background-color: #f63;
}
div.weui-wepay-flow__li {
  width: 9px;
  height: 9px;
}
div.weui-wepay-flow__li .weui-wepay-flow__state {
  width: 9px;
  height: 9px;
  line-height: 9px;
}
</style>

<style lang="less" scoped>
.productDetailBox {
  width: 100%;
  height: 3.4rem;
  background-color: #3d477b;
  color: #fff;
  h3 {
    padding: .3rem .3rem 0;
    height: .6rem;
    font-size: .28rem;
  }
  .chart {
    margin-top: .1rem;
    padding: 0 .14rem .3rem;
    display: flex;
    .item {
      flex: 1;
      padding: 0 .16rem;
      border-right: 1px solid #bfbfbf;
      strong {
        // todo 此处需要用到 PingFang-SC-Bold 字体
        display: block;
        font-weight: normal;
        font-size: .4rem;
      }
      span {
        display: block;
        font-size: .2rem;
      }
    }
    :last-child {
      border-right: 0 none;
    }
    & .red {
      color: #f63;
    }
  }
  .button{
display: flex;
padding: .4rem .3rem;
}
  .chartInfo {
    padding: .1rem .3rem 0;
    dfn {
      position: relative;
      display: block;
      height: .16rem;
      background-color: rgba(255,255,255,.5);
      border-radius: .04rem;
      i {
        position: absolute;
        width: 2.4rem;
        height: .16rem;
        border-radius: .04rem;
        background-color: rgba(255,255,255,1);
      }
    }
    p {
      margin-top: .2rem;
      font-size: .2rem;
    }
  }
}
.detailInfo {
  margin-top: .2rem;
  padding: 0 .3rem .2rem;
  background-color: #fff;
  h2 {
    font-size: .3rem;
    line-height: .8rem;
    border-bottom: 1px solid #eaeaea;
    font-weight: bold;
  }
  .detailMain {
    padding: .16rem 0;
    dl {
      display: flex;
      line-height: .6rem;
      dt {
        width: 2.2rem;
        color: #999;
      }
      dd {
        flex: 1;
        text-align: right;
      }
    }
  }
}
.left{
    display:flex;
    justify-content: space-between;
    padding: 0 .5rem;
  }
.line{
    display:flex;
    justify-content: space-between;
    padding: 0 .5rem;
    border-bottom: 1px solid #333;
  }
  .benefit{
   text-align: center;
   padding-top: .2rem;
  }
  .bottom{
    display: flex;
    justify-content: space-between;
    padding: 0 .5rem;
  }
.right{
  padding-right: .2rem
}
.trade{
  padding-left: .2rem
}
.dy-footer{
      position: absolute;
      left: 0;
      bottom: 0;
      overflow: hidden;
      width: 100%;
      .buy-button{
        padding: 0.2rem 0.4rem 0.2rem;
        border-top: .01rem solid #d9d9d9;
        background-color: #fff;
        .weui-btn:after{
          /*border: none;*/
        }
      }
    }
          .scroll-container {
        width:100%;
        height: 100%;
        padding-top: 1rem;
        .scroll-box {
          width:100%;
          height: 100%;
          .tran-detail-item {
            li {
              border-top: .01rem solid #DBDBDB;
              &:first-child{
                border: none;
              }
              .detail-content {
                width: 100%;
                height: 1.34rem;
                padding: .3rem .28rem .26rem;
                display: flex;
                align-items: center;
                justify-content: space-between;
                .expense-title {
                  h4 {
                    font-size: .28rem;
                    color: #333333;
                  }
                  .expense-info {
                    font-size: .24rem;
                    color: #9b9b9b;
                    span {
                      padding-right: .14rem;
                    }
                  }
                }
              }
            }
          }
        }
      }
.holiday{
    font-size: .26rem;
    text-align: center;
    padding-bottom: .3rem
}

.chartProgress {
  line-height: 1;
  p {
    font-size: .26rem;
    padding: .35rem .3rem 0;
    text-align: right;
    font-weight: normal;
    color: #f63;
  }
  h4 {
    font-size: .2rem;
    font-weight: bold;
    color: #333;
  }
  span {
    font-size: .18rem;
    color: #999;
  }
}
</style>
